use `yongbao`

-- ----------------------------
-- Table structure for admin
-- ----------------------------
DROP TABLE IF EXISTS `admin`;
CREATE TABLE `admin`
(
    `id`          bigint       NOT NULL AUTO_INCREMENT COMMENT '自增主键',
    `name`        varchar(20)  NOT NULL COMMENT '姓名',
    `mobile`      varchar(20)  NOT NULL COMMENT '手机号',
    `acnt`        varchar(20)  NOT NULL COMMENT '账号',
    `pwd`         varchar(200) NOT NULL COMMENT '密码',
    `operator`    varchar(50)  NOT NULL DEFAULT '' COMMENT '操作人',
    `create_time` timestamp    NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `update_time` timestamp    NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间 ',
    PRIMARY KEY (`id`) USING BTREE,
    UNIQUE KEY `idx_acnt` (`acnt`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=utf8mb3 COMMENT='管理员用户表';

-- ----------------------------
-- Records of admin
-- ----------------------------
BEGIN;
INSERT INTO `admin` (`id`, `name`, `mobile`, `acnt`, `pwd`, `operator`, `create_time`, `update_time`)
VALUES (1, 'admin', '18981732326', 'admin', '123456', 'admin', '2021-10-21 15:46:46', '2022-03-14 12:38:38');
COMMIT;

-- ----------------------------
-- Table structure for admin_role
-- ----------------------------
DROP TABLE IF EXISTS `admin_role`;
CREATE TABLE `admin_role`
(
    `admin_id`    bigint      NOT NULL COMMENT '管理员ID',
    `role_id`     int         NOT NULL COMMENT '角色ID',
    `operator`    varchar(50) NOT NULL DEFAULT '' COMMENT '操作人',
    `create_time` timestamp   NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `update_time` timestamp   NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间',
    PRIMARY KEY (`admin_id`, `role_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COMMENT='管理员角色关系表';

-- ----------------------------
-- Records of admin_role
-- ----------------------------
BEGIN;
INSERT INTO `admin_role` (`admin_id`, `role_id`, `operator`, `create_time`, `update_time`)
VALUES (1, 1, '', '2022-05-21 17:53:29', '2022-05-21 17:53:29');
COMMIT;

-- ----------------------------
-- Table structure for area_street
-- ----------------------------
DROP TABLE IF EXISTS `area_street`;
CREATE TABLE `area_street`
(
    `id`          bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
    `name`        varchar(1024) DEFAULT NULL COMMENT '区/街道名称',
    `code`        varchar(255)  DEFAULT NULL COMMENT '区/街道编码',
    `parent_id`   bigint        DEFAULT '0' COMMENT '父级id',
    `deleted`     tinyint(1) DEFAULT '0' COMMENT '删除 0否 1是',
    `update_user` bigint        DEFAULT NULL COMMENT '更新人',
    `update_time` datetime      DEFAULT NULL COMMENT '更新时间',
    `create_user` bigint        DEFAULT NULL COMMENT '创建人',
    `create_time` datetime      DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1402314301071361 DEFAULT CHARSET=utf8mb3 COMMENT='区/街道表';

-- ----------------------------
-- Records of area_street
-- ----------------------------
BEGIN;
INSERT INTO `area_street` (`id`, `name`, `code`, `parent_id`, `deleted`, `update_user`, `update_time`, `create_user`,
                           `create_time`)
VALUES (1402027399561216, '玉林街道', '222', 1402027068874752, 0, 1, '2024-03-26 21:20:39', 1, '2024-03-26 21:20:28');
INSERT INTO `area_street` (`id`, `name`, `code`, `parent_id`, `deleted`, `update_user`, `update_time`, `create_user`,
                           `create_time`)
VALUES (1402027502616576, '苍溪县', '', 0, 0, 1, '2024-03-26 21:22:34', 1, '2024-03-26 21:22:34');
INSERT INTO `area_street` (`id`, `name`, `code`, `parent_id`, `deleted`, `update_user`, `update_time`, `create_user`,
                           `create_time`)
VALUES (1402035366920192, '解放路西段', '', 1402027502616576, 0, 1, '2024-03-27 00:02:34', 1, '2024-03-27 00:02:34');
INSERT INTO `area_street` (`id`, `name`, `code`, `parent_id`, `deleted`, `update_user`, `update_time`, `create_user`,
                           `create_time`)
VALUES (1402063863373824, '金牛区', NULL, 0, 0, 1, '2024-03-27 09:42:19', 1, '2024-03-27 09:42:19');
INSERT INTO `area_street` (`id`, `name`, `code`, `parent_id`, `deleted`, `update_user`, `update_time`, `create_user`,
                           `create_time`)
VALUES (1402178223726592, '兴贤街', '', 1402027502616576, 0, 1, '2024-03-29 00:29:00', 1, '2024-03-29 00:29:00');
INSERT INTO `area_street` (`id`, `name`, `code`, `parent_id`, `deleted`, `update_user`, `update_time`, `create_user`,
                           `create_time`)
VALUES (1402313703587840, '雁塔区', NULL, 0, 0, 1, '2024-03-30 22:25:20', 1, '2024-03-30 22:25:20');
INSERT INTO `area_street` (`id`, `name`, `code`, `parent_id`, `deleted`, `update_user`, `update_time`, `create_user`,
                           `create_time`)
VALUES (1402313712377856, '未央区', NULL, 0, 0, 1, '2024-03-30 22:25:31', 1, '2024-03-30 22:25:31');
INSERT INTO `area_street` (`id`, `name`, `code`, `parent_id`, `deleted`, `update_user`, `update_time`, `create_user`,
                           `create_time`)
VALUES (1402313723887616, '新城区', NULL, 0, 0, 1, '2024-03-30 22:25:45', 1, '2024-03-30 22:25:45');
INSERT INTO `area_street` (`id`, `name`, `code`, `parent_id`, `deleted`, `update_user`, `update_time`, `create_user`,
                           `create_time`)
VALUES (1402313732833280, '碑林区', NULL, 0, 0, 1, '2024-03-30 22:25:56', 1, '2024-03-30 22:25:56');
INSERT INTO `area_street` (`id`, `name`, `code`, `parent_id`, `deleted`, `update_user`, `update_time`, `create_user`,
                           `create_time`)
VALUES (1402313738797056, '灞桥区', NULL, 0, 0, 1, '2024-03-30 22:26:03', 1, '2024-03-30 22:26:03');
INSERT INTO `area_street` (`id`, `name`, `code`, `parent_id`, `deleted`, `update_user`, `update_time`, `create_user`,
                           `create_time`)
VALUES (1402313744302080, '高新区', NULL, 0, 0, 1, '2024-03-30 22:26:10', 1, '2024-03-30 22:26:10');
INSERT INTO `area_street` (`id`, `name`, `code`, `parent_id`, `deleted`, `update_user`, `update_time`, `create_user`,
                           `create_time`)
VALUES (1402313750274048, '曲江区', NULL, 0, 0, 1, '2024-03-30 22:26:17', 1, '2024-03-30 22:26:17');
INSERT INTO `area_street` (`id`, `name`, `code`, `parent_id`, `deleted`, `update_user`, `update_time`, `create_user`,
                           `create_time`)
VALUES (1402313763078144, '长安区', NULL, 0, 0, 1, '2024-03-30 22:26:33', 1, '2024-03-30 22:26:33');
INSERT INTO `area_street` (`id`, `name`, `code`, `parent_id`, `deleted`, `update_user`, `update_time`, `create_user`,
                           `create_time`)
VALUES (1402313772081152, '经开区', NULL, 0, 0, 1, '2024-03-30 22:26:44', 1, '2024-03-30 22:26:44');
INSERT INTO `area_street` (`id`, `name`, `code`, `parent_id`, `deleted`, `update_user`, `update_time`, `create_user`,
                           `create_time`)
VALUES (1402314301071360, '未央宫街道', '', 1402313712377856, 0, 1, '2024-03-30 22:37:30', 1, '2024-03-30 22:37:30');
COMMIT;

-- ----------------------------
-- Table structure for dish
-- ----------------------------
DROP TABLE IF EXISTS `dish`;
CREATE TABLE `dish`
(
    `id`                bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
    `dish_name`         varchar(255) DEFAULT NULL COMMENT '菜品名称',
    `dish_img`          varchar(255) DEFAULT NULL COMMENT '菜品图片',
    `dish_introduction` varchar(255) DEFAULT NULL COMMENT '菜品描述',
    `deleted`           tinyint(1) DEFAULT '0' COMMENT '删除 0否 1是',
    `update_user`       bigint       DEFAULT NULL COMMENT '更新人',
    `update_time`       datetime     DEFAULT NULL COMMENT '更新时间',
    `create_user`       bigint       DEFAULT NULL COMMENT '创建人',
    `create_time`       datetime     DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1405775321251841 DEFAULT CHARSET=utf8mb3 COMMENT='菜品表';

-- ----------------------------
-- Table structure for dish_order
-- ----------------------------
DROP TABLE IF EXISTS `dish_order`;
CREATE TABLE `dish_order`
(
    `id`               bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
    `order_num`        varchar(255)  DEFAULT NULL COMMENT '订单编号',
    `user_id`          bigint        DEFAULT NULL COMMENT '发起人id',
    `area_id`          bigint        DEFAULT NULL COMMENT '区id',
    `area_name`        varchar(255)  DEFAULT NULL COMMENT '区域名称',
    `area_name_prefix` varchar(255)  DEFAULT NULL COMMENT '区域名称前缀',
    `street_id`        bigint        DEFAULT NULL COMMENT '街道id',
    `street_name`      varchar(255)  DEFAULT NULL COMMENT '街道名称',
    `address`          varchar(1024) DEFAULT NULL COMMENT '具体地址',
    `lng`              varchar(255)  DEFAULT NULL COMMENT '经度(下单地址的经度)',
    `lat`              varchar(255)  DEFAULT NULL COMMENT '纬度(下单地址的纬度)',
    `book_breakfast`   tinyint(1) DEFAULT '0' COMMENT '预定早餐  0否 1是',
    `book_lunch`       tinyint(1) DEFAULT '0' COMMENT '预定中午饭  0否 1是',
    `book_dinner`      tinyint(1) DEFAULT '0' COMMENT '预定下午饭  0否 1是',
    `order_type`       varchar(20)   DEFAULT NULL COMMENT '订餐类型 1周餐 2月餐',
    `start_date`       datetime      DEFAULT NULL COMMENT '送餐开始日期',
    `end_date`         datetime      DEFAULT NULL COMMENT '送餐结束日期',
    `deleted`          tinyint(1) DEFAULT '0' COMMENT '删除 0否 1是',
    `update_user`      bigint        DEFAULT NULL COMMENT '更新人',
    `update_time`      datetime      DEFAULT NULL COMMENT '更新时间',
    `create_user`      bigint        DEFAULT NULL COMMENT '创建人',
    `create_time`      datetime      DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1406484782661633 DEFAULT CHARSET=utf8mb3 COMMENT='订单表';

-- ----------------------------
-- Records of dish_order
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for dish_order_book
-- ----------------------------
DROP TABLE IF EXISTS `dish_order_book`;
CREATE TABLE `dish_order_book`
(
    `id`           bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
    `order_id`     bigint   DEFAULT NULL COMMENT '订单id',
    `sub_order_id` bigint   DEFAULT NULL COMMENT '子订单id',
    `dish_id`      bigint   DEFAULT NULL COMMENT '菜品id',
    `book_num`     int      DEFAULT NULL COMMENT '预定数量',
    `deleted`      tinyint(1) DEFAULT '0' COMMENT '删除 0否 1是',
    `update_user`  bigint   DEFAULT NULL COMMENT '更新人',
    `update_time`  datetime DEFAULT NULL COMMENT '更新时间',
    `create_user`  bigint   DEFAULT NULL COMMENT '创建人',
    `create_time`  datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1384477391446630 DEFAULT CHARSET=utf8mb3 COMMENT='订单菜品预定表';

-- ----------------------------
-- Records of dish_order_book
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for dish_order_dish
-- ----------------------------
DROP TABLE IF EXISTS `dish_order_dish`;
CREATE TABLE `dish_order_dish`
(
    `id`          bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
    `order_id`    bigint   DEFAULT NULL COMMENT '订单id',
    `dish_id`     bigint   DEFAULT NULL COMMENT '菜品id',
    `deleted`     tinyint(1) DEFAULT '0' COMMENT '删除 0否 1是',
    `update_user` bigint   DEFAULT NULL COMMENT '更新人',
    `update_time` datetime DEFAULT NULL COMMENT '更新时间',
    `create_user` bigint   DEFAULT NULL COMMENT '创建人',
    `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1384477391446436 DEFAULT CHARSET=utf8mb3 COMMENT='订单菜品表';

-- ----------------------------
-- Table structure for dish_order_sub
-- ----------------------------
DROP TABLE IF EXISTS `dish_order_sub`;
CREATE TABLE `dish_order_sub`
(
    `id`           bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
    `order_id`     bigint         DEFAULT NULL COMMENT '主订单id',
    `user_id`      bigint         DEFAULT NULL COMMENT '用户id',
    `lng`          varchar(255)   DEFAULT NULL COMMENT '经度(下单时定位经度)',
    `lat`          varchar(255)   DEFAULT NULL COMMENT '纬度(下单时定位纬度)',
    `head_group`   int            DEFAULT NULL COMMENT '是否愿意成为团长 0否 1是',
    `mobile`       varchar(255)   DEFAULT NULL COMMENT '手机号',
    `order_amount` decimal(10, 2) DEFAULT NULL COMMENT '总价',
    `deleted`      tinyint(1) DEFAULT '0' COMMENT '删除 0否 1是',
    `update_user`  bigint         DEFAULT NULL COMMENT '更新人',
    `update_time`  datetime       DEFAULT NULL COMMENT '更新时间',
    `create_user`  bigint         DEFAULT NULL COMMENT '创建人',
    `create_time`  datetime       DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1384477391446633 DEFAULT CHARSET=utf8mb3 COMMENT='订单从表';

-- ----------------------------
-- Table structure for dish_specification
-- ----------------------------
DROP TABLE IF EXISTS `dish_specification`;
CREATE TABLE `dish_specification`
(
    `id`                bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
    `dish_id`           bigint         DEFAULT NULL COMMENT '菜品id',
    `spec_name`         varchar(255)   DEFAULT NULL COMMENT '规格名称',
    `sepc_img`          varchar(255)   DEFAULT NULL COMMENT '规格图片',
    `available_persons` varchar(255)   DEFAULT NULL COMMENT '适用人数',
    `sell_price`        decimal(10, 2) DEFAULT NULL COMMENT '售卖价格',
    `deleted`           tinyint(1) DEFAULT '0' COMMENT '删除 0否 1是',
    `update_user`       bigint         DEFAULT NULL COMMENT '更新人',
    `update_time`       datetime       DEFAULT NULL COMMENT '更新时间',
    `create_user`       bigint         DEFAULT NULL COMMENT '创建人',
    `create_time`       datetime       DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1406482682519553 DEFAULT CHARSET=utf8mb3 COMMENT='菜品规格表';

-- ----------------------------
-- Table structure for dish_time_setting
-- ----------------------------
DROP TABLE IF EXISTS `dish_time_setting`;
CREATE TABLE `dish_time_setting`
(
    `id`          bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
    `type`        tinyint(1) DEFAULT NULL COMMENT '类型 1早餐 2中餐 3晚餐',
    `time_period` varchar(255) DEFAULT NULL COMMENT '时间段',
    `deleted`     tinyint(1) DEFAULT '0' COMMENT '删除 0否 1是',
    `update_user` bigint       DEFAULT NULL COMMENT '更新人',
    `update_time` datetime     DEFAULT NULL COMMENT '更新时间',
    `create_user` bigint       DEFAULT NULL COMMENT '创建人',
    `create_time` datetime     DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1405459017367553 DEFAULT CHARSET=utf8mb3 COMMENT='餐品时间设置表';

-- ----------------------------
-- Table structure for permission
-- ----------------------------
DROP TABLE IF EXISTS `permission`;
CREATE TABLE `permission`
(
    `id`          int          NOT NULL AUTO_INCREMENT COMMENT '主键ID',
    `parent_id`   int          NOT NULL COMMENT '上一级id',
    `name`        varchar(20)  NOT NULL COMMENT '权限名称',
    `type`        tinyint      NOT NULL DEFAULT '0' COMMENT '权限类型： 0：页面，1：按钮',
    `code`        varchar(50)           DEFAULT '' COMMENT '权限CODE',
    `descpt`      varchar(100) NOT NULL DEFAULT '' COMMENT '权限描述',
    `operator`    varchar(50)  NOT NULL DEFAULT '' COMMENT '操作人',
    `create_time` timestamp    NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `update_time` timestamp    NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=11180 DEFAULT CHARSET=utf8mb3 COMMENT='管理员权限表';

-- ----------------------------
-- Records of permission
-- ----------------------------
BEGIN;
INSERT INTO `permission` (`id`, `parent_id`, `name`, `type`, `code`, `descpt`, `operator`, `create_time`, `update_time`)
VALUES (10000, 0, 'BANNER', 0, 'PAGE_BANNER', '', '', '2024-03-09 21:02:51', '2024-03-09 21:02:51');
COMMIT;

-- ----------------------------
-- Table structure for role
-- ----------------------------
DROP TABLE IF EXISTS `role`;
CREATE TABLE `role`
(
    `id`          int         NOT NULL AUTO_INCREMENT COMMENT '主键ID',
    `name`        varchar(20) NOT NULL COMMENT '角色名称',
    `descpt`      varchar(50) DEFAULT '' COMMENT '角色描述',
    `operator`    varchar(50) DEFAULT '' COMMENT '操作人',
    `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1000 DEFAULT CHARSET=utf8mb3 COMMENT='管理员角色表';

-- ----------------------------
-- Records of role
-- ----------------------------
BEGIN;
INSERT INTO `role` (`id`, `name`, `descpt`, `operator`, `create_time`, `update_time`)
VALUES (1, '超级管理员', '拥有全部权限', '超级管理员', '2022-05-21 17:46:05', '2022-05-21 17:46:05');
COMMIT;

-- ----------------------------
-- Table structure for role_permission
-- ----------------------------
DROP TABLE IF EXISTS `role_permission`;
CREATE TABLE `role_permission`
(
    `role_id`       int         NOT NULL,
    `permission_id` int         NOT NULL,
    `operator`      varchar(50) NOT NULL DEFAULT '' COMMENT '操作人',
    `create_time`   timestamp   NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `update_time`   timestamp   NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间',
    PRIMARY KEY (`role_id`, `permission_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COMMENT='角色权限关系表';

-- ----------------------------
-- Records of role_permission
-- ----------------------------
BEGIN;
INSERT INTO `role_permission` (`role_id`, `permission_id`, `operator`, `create_time`, `update_time`)
VALUES (1, 10000, '', '2022-05-21 17:46:05', '2022-05-21 17:46:05');
COMMIT;

-- ----------------------------
-- Table structure for user
-- ----------------------------
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user`
(
    `id`          bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
    `real_name`   varchar(20)  DEFAULT NULL COMMENT '姓名',
    `mobile`      varchar(20)  DEFAULT NULL COMMENT '手机号',
    `nick_name`   varchar(50)  DEFAULT NULL COMMENT '昵称',
    `avatar`      varchar(255) DEFAULT NULL COMMENT '头像',
    `sex`         smallint     DEFAULT NULL COMMENT '性别 0女 1男',
    `birthday`    date         DEFAULT NULL COMMENT '生日',
    `open_id`     varchar(255) DEFAULT NULL COMMENT 'openId',
    `status`      tinyint(1) DEFAULT '1' COMMENT '用户状态 0禁用 1正常',
    `head_group`  tinyint(1) DEFAULT '0' COMMENT '是否成为过团长 0否 1是',
    `deleted`     tinyint(1) DEFAULT '0' COMMENT '删除 0否 1是',
    `update_user` bigint       DEFAULT NULL COMMENT '更新人',
    `update_time` datetime     DEFAULT NULL COMMENT '更新时间',
    `create_user` bigint       DEFAULT NULL COMMENT '创建人',
    `create_time` datetime     DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1400974426465235 DEFAULT CHARSET=utf8mb3 COMMENT='用户表';

-- ----------------------------
-- Records of user
-- ----------------------------
BEGIN;
COMMIT;

SET
FOREIGN_KEY_CHECKS = 1;
